home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / lame_src / Makefile.WOS < prev    next >
Encoding:
Makefile  |  2000-01-01  |  11.2 KB  |  388 lines

  1. # Makefile for LAME 3.xx
  2. #
  3. # LAME is reported to work under:  
  4. # Linux (i86), NetBSD 1.3.2 (StrongARM), FreeBSD (i86)
  5. # Compaq Alpha(OSF, Linux, Tru64 Unix), Sun Solaris, SGI IRIX,
  6. # OS2 Warp, Macintosh PPC, BeOS, Amiga and even VC++ 
  7. UNAME = $(shell uname)
  8. ARCH = $(shell uname -m)
  9.  
  10.  
  11. # generic defaults. OS specific options go in versious sections below
  12. PGM = lame.elf
  13. CC = ppc-amigaos-gcc -warpup
  14. CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops -mmultiple \
  15.                     -mcpu=603e -fforce-addr -fforce-mem
  16. GTK = 
  17. GTKLIBS = 
  18. SNDLIB = -DLAMESNDFILE
  19. LIBSNDFILE =  
  20. LIBS = 
  21. MAKEDEP = -MM
  22. BRHIST_SWITCH = -DBRHIST -DNOTERMCAP
  23. LIBTERMCAP = 
  24. RM = rm -f
  25.  
  26.  
  27.  
  28. ##########################################################################
  29. # -DHAVEMPGLIB compiles the mpglib *decoding* library into libmp3lame
  30. ##########################################################################
  31. CPP_OPTS += -DHAVEMPGLIB 
  32.  
  33. ##########################################################################
  34. # -DFLOAT8_is_float will FLOAT8 as float
  35. # -DFLOAT8_is_double  will FLOAT8 as double (default)
  36. #  NOTE: RH: 7/00:  if FLOAT8=float, it breaks resampling and VBR code 
  37. ##########################################################################
  38. CPP_OPTS += -DFLOAT8_is_double
  39.  
  40.  
  41.  
  42.  
  43. ##########################################################################
  44. # Define these in the OS specific sections below to compile in support
  45. # for the Ogg Vorbis audio format (both decoding and encoding)
  46. # VORBIS = -DHAVEVORBIS  -I ../vorbis/include
  47. # VORBIS_LIB = -L ../vorbis/lib -lvorbis
  48. ##########################################################################
  49.  
  50. ##########################################################################
  51. # Define these in the OS specific sections below to compile in code 
  52. # for the optional VBR bitrate histogram.  
  53. # Requires ncurses, but libtermcap also works.  
  54. # If you have any trouble, just dont define these
  55. #
  56. # BRHIST_SWITCH = -DBRHIST
  57. # LIBTERMCAP = -lncurses
  58. # LIBTERMCAP = -ltermcap
  59. #
  60. # or, to try and simulate TERMCAP (ANSI), use:
  61. # BRHIST_SWITCH = -DBRHIST -DNOTERMCAP
  62. #
  63. ##########################################################################
  64.  
  65.  
  66. ##########################################################################
  67. # Define these in the OS specific sections below to compile in code for:
  68. #
  69. # SNDLIB =                no file i/o 
  70. # SNDLIB = -DLAMESNDFILE  to use internal LAME soundfile routines 
  71. # SNDLIB = -DLIBSNDFILE   to use Erik de Castro Lopo's libsndfile 
  72. # http://www.zip.com.au/~erikd/libsndfile/
  73. #
  74. # Note: at present, libsndfile does not support input from stdin.  
  75. #
  76. # for example:
  77. #  SNDLIB = -DLIBSNDFILE
  78. #  LIBSNDFILE=-lsndfile 
  79. #  if libsndfile is in a custom location, try:
  80. #  LIBSNDFILE=-L $(LIBSNDHOME) -lsndfile  -I $(LIBSNDHOME)
  81. ##########################################################################
  82.  
  83.  
  84. ##########################################################################
  85. # Define these in the OS specific sections below to compile in code for
  86. # the GTK mp3 frame analyzer
  87. #
  88. # Requires  -DHAVEMPGLIB
  89. # and SNDLIB = -DLAME or -DLIBSNDFILE
  90. #
  91. # GTK = -DHAVEGTK `gtk-config --cflags`
  92. # GTKLIBS = `gtk-config --libs` 
  93. #
  94. ##########################################################################
  95.  
  96.  
  97.  
  98.  
  99. ##########################################################################
  100. # LINUX   
  101. ##########################################################################
  102. ifeq ($(UNAME),Linux)
  103. #  remove these lines if you dont have GTK, or dont want the GTK frame analyzer
  104.    GTK = -DHAVEGTK `gtk-config --cflags`
  105.    GTKLIBS = `gtk-config --libs` 
  106. # Comment out next 2 lines if you want to remove VBR histogram capability
  107.    BRHIST_SWITCH = -DBRHIST
  108.    LIBTERMCAP = -lncurses
  109. #  uncomment to use LIBSNDFILE
  110. #   SNDLIB = -DLIBSNDFILE
  111. #   LIBSNDFILE=-lsndfile 
  112.  
  113. # uncomment to compile in Vorbis support
  114. #   VORBIS = -DHAVEVORBIS -I/home/mt/mp3/vorbis/include
  115. #   VORBIS_LIB = -L/home/mt/mp3/vorbis/lib -lvorbis
  116.  
  117.  
  118. # suggested for gcc-2.7.x
  119.    CC_OPTS =  -O3 -fomit-frame-pointer -funroll-loops -ffast-math  -finline-functions -Wall
  120. #  CC_OPTS =  -O9 -fomit-frame-pointer -fno-strength-reduce -mpentiumpro -ffast-math -finline-functions -funroll-loops -Wall -malign-double -g -march=pentiumpro -mfancy-math-387 -pipe 
  121.  
  122. #  for debugging:
  123. #   CC_OPTS =  -UNDEBUG -O -Wall -g -DABORTFP
  124.  
  125. #  for lots of debugging:
  126. #   CC_OPTS =  -DDEBUG -UNDEBUG  -O -Wall -g -DABORTFP 
  127.  
  128.  
  129.  
  130. # these options for gcc-2.95.2 to produce fast code
  131. #   CC_OPTS = $(FEATURES)\
  132. #    -Wall -O9 -fomit-frame-pointer -march=pentium \
  133. #    -finline-functions -fexpensive-optimizations \
  134. #    -funroll-loops -funroll-all-loops -pipe -fschedule-insns2 \
  135. #    -fstrength-reduce \
  136. #    -malign-double -mfancy-math-387 -ffast-math 
  137.  
  138.  
  139. ##########################################################################
  140. # LINUX on Digital/Compaq Alpha CPUs
  141. ##########################################################################
  142. ifeq ($(ARCH),alpha)
  143. # double is faster than float on Alpha
  144. CC_OPTS =       -O4 -Wall -fomit-frame-pointer -ffast-math -funroll-loops \
  145.                 -mfp-regs -fschedule-insns -fschedule-insns2 \
  146.                 -finline-functions \
  147. #                -DFLOAT=double
  148. # add "-mcpu=21164a -Wa,-m21164a" to optimize for 21164a (ev56) CPU
  149.  
  150. # Compaq's C Compiler
  151. #CC = ccc
  152. # Options for Compaq's C Compiler
  153. #CC_OPTS = -fast -Wall
  154.  
  155. # standard Linux libm
  156. #LIBS    =    -lm  
  157. # optimized libffm (free fast math library)
  158. #LIBS    =    -lffm  
  159. # Compaq's fast math library
  160. LIBS    =       -lcpml 
  161. endif
  162. endif
  163.  
  164.  
  165.  
  166. ##########################################################################
  167. # FreeBSD
  168. ##########################################################################
  169. ifeq ($(UNAME),FreeBSD)
  170. #  remove if you do not have GTK or do not want the GTK frame analyzer
  171.    GTK = -DHAVEGTK `gtk12-config --cflags`
  172.    GTKLIBS = `gtk12-config --libs` 
  173. # Comment out next 2 lines if you want to remove VBR histogram capability
  174.    BRHIST_SWITCH = -DBRHIST
  175.    LIBTERMCAP = -lncurses
  176.  
  177. endif
  178.  
  179.  
  180. ##########################################################################
  181. # SunOS
  182. ##########################################################################
  183. ifeq ($(UNAME),SunOS) 
  184.    CC = cc
  185.    CC_OPTS = -O -xCC      
  186.    MAKEDEP = -xM
  187. endif
  188.  
  189.  
  190. ##########################################################################
  191. # SGI
  192. ##########################################################################
  193. ifeq ($(UNAME),IRIX64) 
  194.    CC = cc
  195.    CC_OPTS = -O3 -woff all 
  196.  
  197. #optonal:
  198. #   GTK = -DHAVEGTK `gtk-config --cflags`
  199. #   GTKLIBS = `gtk-config --libs`
  200. #   BRHIST_SWITCH = -DBRHIST
  201. #   LIBTERMCAP = -lncurses
  202.  
  203. endif
  204. ifeq ($(UNAME),IRIX) 
  205.    CC = cc
  206.    CC_OPTS = -O3 -woff all 
  207. endif
  208.  
  209.  
  210.  
  211. ##########################################################################
  212. # Compaq Alpha running Dec Unix (OSF)
  213. ##########################################################################
  214. ifeq ($(UNAME),OSF1)
  215.    CC = cc
  216.    CC_OPTS = -fast -O3 -std -g3 -non_shared
  217. endif
  218.  
  219. ##########################################################################
  220. # BeOS
  221. ##########################################################################
  222. ifeq ($(UNAME),BeOS)
  223.    CC = $(BE_C_COMPILER)
  224.    LIBS =
  225. ifeq ($(ARCH),BePC)
  226.    CC_OPTS = -O9 -fomit-frame-pointer -march=pentium \
  227.    -mcpu=pentium -ffast-math -funroll-loops \
  228.    -fprofile-arcs -fbranch-probabilities
  229. else
  230.    CC_OPTS = -opt all
  231.    MAKEDEP = -make
  232. endif
  233. endif
  234.  
  235. ###########################################################################
  236. # MOSXS (Rhapsody PPC)
  237. ###########################################################################
  238. ifeq ($(UNAME),Rhapsody)
  239.    CC = cc
  240.    LIBS =
  241.    CC_OPTS = -O9 -ffast-math -funroll-loops -fomit-frame-pointer
  242.    MAKEDEP = -make 
  243.    
  244. endif
  245. ##########################################################################
  246. # OS/2
  247. ##########################################################################
  248. # Properly installed EMX runtime & development package is a prerequisite.
  249. # tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
  250. #
  251. ##########################################################################
  252. ifeq ($(UNAME),OS/2)
  253.    SHELL=sh    
  254.    CC = gcc
  255.    CC_OPTS = -O3
  256.    PGM = lame.exe
  257.    LIBS =
  258.  
  259. # I use the following for slightly better performance on my Pentium-II
  260. # using pgcc-2.91.66:
  261. #   CC_OPTS = -O6 -ffast-math -funroll-loops -mpentiumpro -march=pentiumpro
  262.  
  263. # Comment out next 2 lines if you want to remove VBR histogram capability
  264.    BRHIST_SWITCH = -DBRHIST
  265.    LIBTERMCAP = -ltermcap
  266.  
  267. # Uncomment & inspect the 2 GTK lines to use MP3x GTK frame analyzer.
  268. # Properly installed XFree86/devlibs & GTK+ is a prerequisite.
  269. # The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
  270. #   GTK = -DHAVEGTK -IC:/XFree86/include/gtk12 -Zmt -D__ST_MT_ERRNO__ -IC:/XFree86/include/glib12 -IC:/XFree86/include
  271. #   GTKLIBS = -LC:/XFree86/lib -Zmtd -Zsysv-signals -Zbin-files -lgtk12 -lgdk12 -lgmodule -lglib12 -lXext -lX11 -lshm -lbsd -lsocket -lm
  272. endif
  273.  
  274.  
  275.  
  276.  
  277. # 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of
  278. # gcc 2.8+ as of 10/99.  
  279.  
  280. CC_SWITCHES = -DNDEBUG -D__NO_MATH_INLINES $(CC_OPTS) $(SNDLIB) $(GTK) \
  281. $(BRHIST_SWITCH) $(VORBIS) 
  282. c_sources = \
  283.         brhist.c \
  284.     bitstream.c \
  285.     fft.c \
  286.     get_audio.c \
  287.         id3tag.c \
  288.     ieeefloat.c \
  289.         lame.c \
  290.         newmdct.c \
  291.         parse.c \
  292.     portableio.c \
  293.     psymodel.c \
  294.     quantize.c \
  295.     quantize-pvt.c \
  296.     vbrquantize.c \
  297.     reservoir.c \
  298.     tables.c \
  299.     takehiro.c \
  300.     timestatus.c \
  301.     util.c \
  302.     vorbis_interface.c \
  303.         VbrTag.c \
  304.         version.c \
  305.         mpglib/common.c \
  306.         mpglib/dct64_i386.c \
  307.         mpglib/decode_i386.c \
  308.         mpglib/layer3.c \
  309.         mpglib/tabinit.c \
  310.         mpglib/interface.c \
  311.         mpglib/main.c 
  312.  
  313. OBJ = $(c_sources:.c=.o)
  314. DEP = $(c_sources:.c=.d)
  315.  
  316. gtk_sources = gtkanal.c gpkplotting.c
  317. gtk_obj = $(gtk_sources:.c=.o)
  318. gtk_dep = $(gtk_sources:.c=.d)
  319.  
  320.  
  321.  
  322. NASM = nasm
  323. ASFLAGS=-f elf -i i386/
  324. %.o: %.nas
  325.     $(NASM) $(ASFLAGS) $< -o $@
  326. %.o: %.s
  327.     gcc -c $< -o $@
  328.  
  329. ## use MMX extension. you need nasm and MMX supported CPU.
  330. #CC_SWITCCH += -DMMX_choose_table
  331. #OBJ += i386/choose_table.o
  332.  
  333. %.o: %.c 
  334.     $(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@
  335.  
  336. %.d: %.c
  337.     $(SHELL) -ec '$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< | sed '\''s;$*.o;& $@;g'\'' > $@'
  338.  
  339. all: $(PGM)
  340.  
  341. $(PGM):    main.o new_clock.o $(gtk_obj) libmp3lame.a 
  342.     $(CC) $(CC_OPTS) -o $(PGM)  main.o new_clock.o $(gtk_obj) -L. -lmp3lame $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  343.     elf2exe2 $@ lame
  344.  
  345. mp3x:    mp3x.o $(gtk_obj) libmp3lame.a
  346.     $(CC) -o mp3x mp3x.o $(gtk_obj) $(OBJ) $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  347.  
  348. mp3rtp:    rtp.o mp3rtp.o libmp3lame.a
  349.     $(CC) -o mp3rtp mp3rtp.o rtp.o   $(OBJ) $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  350.  
  351. libmp3lame.a:  $(OBJ) Makefile
  352. #    cd libmp3lame
  353. #    make libmp3lame
  354.     ppc-amigaos-ar cr libmp3lame.a  $(OBJ) 
  355.  
  356. clean:
  357.     -$(RM) $(gtk_obj) $(OBJ) $(DEP) $(PGM) main.o rtp.o mp3rtp mp3rtp.o \
  358.          mp3x.o mp3x libmp3lame.a 
  359.  
  360.  
  361. tags: TAGS
  362.  
  363. TAGS: ${c_sources}
  364.     etags -T ${c_sources}
  365.  
  366. ifneq ($(MAKECMDGOALS),clean)
  367.   -include $(DEP)
  368. endif
  369.  
  370.  
  371. #
  372. #  testcase.mp3 is a 2926 byte file.  The first number output by
  373. #  wc is the number of bytes which differ between new output
  374. #  and 'official' results.  
  375. #
  376. #  Because of compilier options and effects of roundoff, the 
  377. #  number of bytes which are different may not be zero, but
  378. #  should be at most 30.
  379. #
  380. test: $(PGM)
  381.     ./lame  --nores -h testcase.wav testcase.new.mp3
  382.     cmp -l testcase.new.mp3 testcase.mp3 | wc
  383.  
  384. testg: $(PGM)
  385.     ./lame -g -h ../test/castanets.wav
  386.